package com.hirain.fbg.quartz;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

/**
 * Created by caicf on 2016/7/24.
 */
//@Configurable
public class Hello extends QuartzJobBean {

//    @Autowired(required = true)
    private MailSendService mailSendService;

    public void setMailSendService(MailSendService mailSendService) {
        this.mailSendService = mailSendService;
    }

    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        System.out.println("hello");
//        mailSendService= (MailSendService) context.getJobDetail().getJobDataMap().get("mailSendService");
        mailSendService.sendMail();
        System.out.println(context.getJobDetail().getKey());
        System.out.println(context.getTrigger().getJobKey());
    }
}
